﻿
<head>
	<meta charset="utf-8">
	<title>登录</title>
	<script src="../js/jquery-3.2.1.min.js"></script>
		<!-- 最新版本的 Bootstrap 核心 CSS 文件 -->
	<link rel="stylesheet" href="../css/bootstrap.min.css" >	
	<!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
	<script src="../js/bootstrap.min.js" ></script>
	<link rel="stylesheet" type="text/css" href="../css/index.css">
</head>
<?php
# 该代码实现的功能是对用户进行分类，显示不同的页面
mysql_connect("localhost","root","root");
mysql_query("set names gbk"); 
echo $userType;
if($userType == 'unknow'){
	echo "请你选择用户类型";
	exit;
}else if ($userType == 'user') {
	# code...
	$query="select * from user where user_id = '$userName' and user_password = '$userPassword'";
	$result = mysql_db_query("psychology","$query");
	if($data = mysql_fetch_object($result)){

		// 网站的头部
		echo "<nav class='navbar navbar-default navbar-fixed-top top' >
		<img class='top_left' src='../images/log.png'>
	
		<div class='pull-right' style='margin-top: 15px;margin-right: 20px;'>
			<a href='http://www.xinli001.com/ceshi'>关于心理测试</a>
			<a href='register.html'>注册</a>
		</div>
		</nav>	";
		// 网站的主体
		echo "<div style='margin-top: 50px;'>欢迎你<a href='userView.php'>学生</a>";
		echo "<span id='time'>5</span>秒后自动跳转
				<h3>点击<a href='userView.php'>跳转</a>手动跳转</h3></div>";
		echo "<!-- JS控制页面自动跳转的时间以及动态的显示还要等待的时间 -->
				<script type='text/javascript'>
					var wait_time = 4;
					setTimeout(\"window.open('userView.php','_self','')\",wait_time*1000);
					setInterval(op,1000);
					function op(){
						document.getElementById('time').innerHTML = wait_time;
									wait_time--;
					}
				</script>";
		echo "<!-- 版权 -->
			<div  style='text-align:center'  class='footer navbar-fixed-bottom '>
				<hr>
				<font>©2018 chenshuwei AND yangliu.<br/>All Rights Reserved.<br/>
			电话：0991-123456</font>
			</div>";
		exit;
	}else{
		echo "请你输入正确用户名或者密码,返回<a href='login.php'>登录页</a>";
		exit;
	}
}else{
	$query="select * from admin where adminName = '$userName' and adminPassword = '$userPassword'";
	$result = mysql_db_query("psychology","$query");
	if($data = mysql_fetch_object($result)){
		// 网站的头部
		echo "<nav class='navbar navbar-default navbar-fixed-top top' >
		<img class='top_left' src='../images/log.png'>
	
		<div class='pull-right' style='margin-top: 15px;margin-right: 20px;'>
			<a href='http://www.xinli001.com/ceshi'>关于心理测试</a>
			<a href='login.php'>登录</a>
		</div>
		</nav>	";
		// 网站主体
		echo "<div style='margin-top: 50px;'>欢迎你<a href='edit.php'>管理员</a>";
		echo "<span id='time'>5</span>秒后自动跳转
				<h3>点击<a href='edit.php'>跳转</a>手动跳转</h3></div>";
		echo "<!-- JS控制页面自动跳转的时间以及动态的显示还要等待的时间 -->
				<script type='text/javascript'>
					var wait_time = 4;
					setTimeout(\"window.open('edit.php','_self','')\",wait_time*1000);
					setInterval(op,1000);
					function op(){
						document.getElementById('time').innerHTML = wait_time;
									wait_time--;
					}
				</script>";
		echo "<!-- 版权 -->
			<div  style='text-align:center'  class='footer navbar-fixed-bottom '>
				<hr>
				<font>©2018 chenshuwei AND yangliu.<br/>All Rights Reserved.<br/>
			电话：0991-123456</font>
			</div>";
		exit;
	}else{
		echo "请你输入正确用户名或者密码,返回<a href='login.php'>登录页</a>";
		exit;	
	}
}



?>